package com.csdj.t309springboot.service;

import com.csdj.t309springboot.entity.PrizeRecord;
import com.csdj.t309springboot.mapper.PrizeRecordMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 获奖信息表 服务实现类
 * </p>
 *
 * @author 谭湛宇
 * @since 2022-01-14
 */
@Service
public class PrizeRecordService extends ServiceImpl<PrizeRecordMapper, PrizeRecord> implements IPrizeRecordService {
    @Resource
    private PrizeRecordMapper prizeRecordMapper;
    /**
     * 查询最新获奖信息, 按获奖时间倒序排列, 只显示 6条
     * @return list列表
     */
    @Override
    public List<PrizeRecord> getTheLatestAward() {
//        QueryWrapper<PrizeRecord> queryWrapper = new QueryWrapper();
//        //降序排列,  添加sql语句
//        queryWrapper.lambda().orderByDesc(PrizeRecord::getTheAwardWinningDate).last(" limit 3 ");
//        return prizeRecordMapper.selectList(queryWrapper);
        return prizeRecordMapper.findTheLatestAward();
    }
}
